{% extends "djdb/internal_page.html" %}

{% load common_extras %}
{% load djdb_extras %}

{% block breadcrumbs %}
<a href="/">chipradio home</a> /
<a href="/djdb/">DJ Database home</a>
{% endblock %}

{% block content %}

{% block extrahead %}
<script type="text/javascript" 
    src="/media/common/js/jquery/jquery-1.3.1.js"></script>
<script type="text/javascript" src="/media/djdb/js/djdb.js"></script>
{% endblock %}

<h3>DJ: <a href="/djdb/user/{{ dj.key.id }}">{{ dj }}</a></h3>

<form action="/djdb/tracks_played/{{ dj.key.id }}" name="paging" method="post">
{{ form }}
  <input type="submit" name="search" value="Search"/>
  <br/>

{% ifequal prev None %}
  <input disabled="disabled" type="submit" name="prev" onclick="document.paging.bookmark.value='{{ prev }}'" value="Previous Page"/>
{% else %}
  <input type="submit" name="prev" onclick="document.paging.bookmark.value='{{ prev }}'" value="Previous Page"/>
{% endifequal %}
{% ifequal next None %}
  <input disabled="disabled" type="submit" name="next" onclick="document.paging.bookmark.value='{{ next }}'" value="Next Page"/>
{% else %}
  <input type="submit" name="next" onclick="document.paging.bookmark.value='{{ next }}'" value="Next Page"/>
{% endifequal %}
  <input type="hidden" id="bookmark" name="bookmark" value=""/>
  <input type="hidden" name="user_id" value="{{ dj.key.id }}"/>
</form>

{% for dt, events in playlist_events %}
{{ dt|date:"D F j, Y P" }}
<table>
  {% for event in events %}
  <tr>
    <td>{{ event.established_display|date:"P" }}</td>
  {% if event.artist %}
    <td><a href="{{ event.artist.url }}">{{ event.artist_name }}</a></td>
  {% else %}
    <td>{{ event.artist_name }}</td>
  {% endif %}
  {% if event.album %}
    <td><a href="{{ event.album.url }}">{{ event.album_title }}</a></td>
  {% else %}
    <td>{{ event.album_title }}</td>
  {% endif %}
    <td>{{ event.track_title }}</td>
    {% if event.label %}
    <td>{{ event.label }}</td>
    {% else %}
    <td>[ Unknown label ]</td>
    {% endif %}
  </tr>
  {% endfor %}
</table>
{% endfor %}

<form action="/djdb/tracks_played/{{ dj.key.id }}" name="paging2" method="post">
{% ifequal prev None %}
  <input disabled="disabled" type="submit" name="prev" onclick="document.paging2.bookmark.value='{{ prev }}'" value="Previous Page"/>
{% else %}
  <input type="submit" name="prev" onclick="document.paging2.bookmark.value='{{ prev }}'" value="Previous Page"/>
{% endifequal %}
{% ifequal next None %}
  <input disabled="disabled" type="submit" name="next" onclick="document.paging2.bookmark.value='{{ next }}'" value="Next Page"/>
{% else %}
  <input type="submit" name="next" onclick="document.paging2.bookmark.value='{{ next }}'" value="Next Page"/>
{% endifequal %}
  <input type="hidden" id="bookmark" name="bookmark" value=""/>
  <input type="hidden" name="user_id" value="{{ dj.key.id }}"/>
</form>

{% endblock %}

